/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frame1.java
 *
 * Created on Nov 25, 2011, 8:39:11 AM
 */
package tok.predmeta;

import java.awt.Component;
import java.sql.Connection;
import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

/**
 *
 * @author root
 */
public class Frame1 extends javax.swing.JFrame {
    public Connection connection;

    /** Creates new form Frame1 */
    public Frame1() {
        initComponents();
         jTextField1.getDocument().addDocumentListener(new DocumentListener() {
           
                    @Override
  public void changedUpdate(DocumentEvent e) {
    warn();
  }
                    @Override
  public void removeUpdate(DocumentEvent e) {
    warn();
  }
                    @Override
  public void insertUpdate(DocumentEvent e) {
    warn();
  }

  public void warn() {
      if (jTextField1.getText().equals("01")) {
          final Pretraga P = new Pretraga();
          dispose();
          P.setVisible(true);
      } else if (jTextField1.getText().equals("02")) {
          Izmena I = new Izmena();
          dispose();
          I.setVisible(true);

      } else if (jTextField1.getText().equals("03")) {
          Edit E = new Edit();
          dispose();
          E.setVisible(true);
      }  else if (jTextField1.getText().equals("04")) {
//          Reminder R = new Reminder();
//          dispose();
//          R.setVisible(true);
          Tabela R = new Tabela();
          dispose();
          R.setVisible(true);
      } else {
           
      }
  }
        });
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pretraga = new javax.swing.JButton();
        dodavanje = new javax.swing.JButton();
        izlaz = new javax.swing.JButton();
        ispravka = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Први основни суд у Београду - Ток обраде захтева");

        pretraga.setText("Претрага и измена локације предмета");
        pretraga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pretragaActionPerformed(evt);
            }
        });

        dodavanje.setText("Додавање предмета");
        dodavanje.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dodavanjeActionPerformed(evt);
            }
        });

        izlaz.setText("Излаз");
        izlaz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                izlazActionPerformed(evt);
            }
        });

        ispravka.setText("Исправка грешке код уноса");
        ispravka.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ispravkaActionPerformed(evt);
            }
        });

        jButton1.setText("Подсетник");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel1.setText("Изаберите једну од опција");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(569, Short.MAX_VALUE)
                .addComponent(izlaz)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(15, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(ispravka, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pretraga, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(dodavanje, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))
                .addGap(23, 23, 23))
            .addGroup(layout.createSequentialGroup()
                .addGap(225, 225, 225)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(259, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(236, 236, 236)
                .addComponent(jLabel1)
                .addContainerGap(267, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(227, 227, 227)
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pretraga)
                    .addComponent(dodavanje))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ispravka)
                    .addComponent(jButton1))
                .addGap(18, 18, 18)
                .addComponent(izlaz)
                .addContainerGap())
        );

        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void dodavanjeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dodavanjeActionPerformed
        Izmena I=new Izmena();
         this.dispose();
       I.setVisible(true);
    }//GEN-LAST:event_dodavanjeActionPerformed

    private void pretragaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pretragaActionPerformed
        final Pretraga P = new Pretraga();
        
         this.dispose();
        P.setVisible(true);

    }//GEN-LAST:event_pretragaActionPerformed

    private void izlazActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_izlazActionPerformed
        System.exit(0);
    }//GEN-LAST:event_izlazActionPerformed

    private void ispravkaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ispravkaActionPerformed
        Edit E=new Edit();
        this.dispose();
        E.setVisible(true);
    }//GEN-LAST:event_ispravkaActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//        Reminder R = new Reminder();
//        this.dispose();
//        R.setVisible(true);
        Tabela R = new Tabela();
          dispose();
          R.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                 Frame1 F=new Frame1();
                         F.setVisible(true);
               

            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton dodavanje;
    private javax.swing.JButton ispravka;
    private javax.swing.JButton izlaz;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private static javax.swing.JTextField jTextField1;
    private javax.swing.JButton pretraga;
    // End of variables declaration//GEN-END:variables
}
